<template>
    <div class="app-container">
        <el-form label-width="80px">
            <el-form-item label="名称">
                <el-input v-model="role.name"></el-input>
            </el-form-item>
            <el-form-item label="备注">
                <el-input v-model="role.remark"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="add()">添加</el-button>
                <el-button @click="back()">返回</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    import {Message, MessageBox} from 'element-ui'
    import roleApi from '@/api/role'

    export default {
        name: "role-manager-add",
        data:function () {
            return {
                role:{
                    name:'',
                    remark:''
                }
            }
        },
        methods:{
            add:function () {
                roleApi.add(this.role)
                    .then(function (data) {
                        if (data.success){
                            Message.success('添加成功')
                            return
                        }
                        Message.error('添加失败')
                    }).catch(function () {
                        Message.error('添加失败')
                    })
            },
            back:function () {
                this.$router.back(-1)
            }
        }


    }
</script>

<style scoped>

</style>
